home *** CD-ROM | disk | FTP | other *** search
/ PC User 2003 January / Disc 3 / Amethyst.iso / live / usr / lib / rpm-3.0.6 / u_pkg.sh < prev    next >
Encoding:
Linux/UNIX/POSIX Shell Script  |  2001-04-06  |  1.6 KB  |  75 lines

  1. #!/bin/sh
  2.  
  3. # a universal interface to Unix OS package managment systems
  4.  
  5. PATH="/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb:/usr/bsd:$PATH"
  6. export PATH
  7.  
  8.  
  9.  
  10. osname=`uname -s`
  11. if test $? -ne 0 || test X$osname = X ; then
  12.     echo "I can't determine what platform this is.  Exiting"
  13.     exit 1
  14. fi
  15.  
  16.  
  17. #
  18. # Set OS dependent defaults
  19. #
  20. case $osname in
  21.     Linux)
  22.         check_all_packages='rpm -Va'
  23.         list_all_packages='rpm -qa'
  24.         list_all_files='rpm -qla'
  25.         list_all_files_in_package='rpm -ql $1'
  26.         full_package_name='rpm -q $1'
  27.         query_file='rpm -qf $1'
  28.         ;;
  29.     SunOS)
  30.         check_all_packages='/usr/sbin/pkgchk -n'
  31.         list_all_files='/usr/sbin/pkgchk -l | /bin/egrep Pathname | /bin/awk "{print \$2}" '
  32.         list_all_files_in_package='/usr/sbin/pkgchk -l $1 | /bin/egrep Pathname | /bin/awk "{print \$2}" '
  33.         list_all_packages='/usr/bin/pkginfo -x | /bin/sed -e "/^[a-zA-Z]/ { N; /^\\n\$/d; s/ .*$//; }" '
  34.         package_version='/usr/bin/pkginfo -x $1 | egrep -v "^[a-zA-Z]" | sed -e "s/(.*)//; s/\ \ *//" '
  35.         query_file='/usr/sbin/pkgchk -l -p $1 | /bin/egrep -v "^[a-zA-Z]" | xargs /usr/bin/pkginfo -x | /bin/sed -e "/^[a-zA-Z]/ { N; /^\\n\$/d; s/\ .*\\n.*//; }" '
  36.         ;;
  37.     OSF1)
  38.         ;;
  39.     HP-UX)
  40.         ;;
  41.     AIX)
  42.         ;;
  43.     IRIX|IRIX64)
  44.         ;;
  45.     *)
  46.         echo "I haven't been configured yet to work on $osname."
  47.         echo "email it to rpm-list@redhat.com, so that your OS"
  48.         echo "will be supported by some future version of this script."
  49.         echo ""
  50.         echo "Thanks!"
  51.         echo
  52.         exit 2
  53.         ;;
  54. esac
  55.  
  56.  
  57.  
  58. option=$1
  59. shift
  60.  
  61. # I would like to have the second $ actually interpolate so I could
  62. # drop the second eval.  Anyone know how to do this?
  63.  
  64. if [ $option = 'print_cmd' ]; then
  65.     option=$1
  66.     shift
  67.     eval echo $"$option"
  68.     exit 0
  69. fi
  70.  
  71. eval eval $"$option"
  72.  
  73.  
  74.  
  75.